﻿/*
 * Created by SharpDevelop.
 * User: notmmao
 * Date: 2008-4-2
 * Time: 8:57
 * 
 */

using System;
using System.Drawing;
using System.Media;

namespace Deebug.Games.ShortBoom
{
	/// <summary>
	/// Description of Alien.
	/// </summary>
	public class Alien:Sprite
	{
		System.ComponentModel.ComponentResourceManager resources 
			= new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
		SoundPlayer sp;
			
		
		public Alien(Gate word,int x,int y,Bitmap frame,Vector vector,float speed)
		:base(word,x,y,frame,vector,speed)
		{
			System.Reflection.Assembly a = System.Reflection.Assembly.GetExecutingAssembly();
    		System.IO.Stream s = a.GetManifestResourceStream("<ShortBoom>.chimes.wav");
    
			sp = new SoundPlayer(s);
		}
		
		public override void UpDate(float gameTime, float elapsedTime)
		{
			Point currentLocation = this.Location;
			int pWidth = this.Word.Size.Width;
			int pHeight = this.Word.Size.Height;
			
			if(currentLocation.X <= 0){
				Vector.X = Math.Abs(Vector.X);
			//	sp.Play();
			}
			if(currentLocation.X >= pWidth - this.Size.Width){
				Vector.X = -Math.Abs(Vector.X);
			//	sp.Play();
			}
			if(currentLocation.Y<=0){
				Vector.Y = Math.Abs(Vector.Y);
			//	sp.Play();
			}
			if(currentLocation.Y>=pHeight -this.Size.Height){
				Vector.Y = -Math.Abs(Vector.Y);
			//	sp.Play();
			}
			
			base.UpDate(gameTime,elapsedTime);
		}
	}
}
